﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Newtonsoft.Json;
using System.Web.Services;
using BLL;
using Model;

namespace PropertyAppraisal.DoemsKanCha
{
    public partial class Domelist : System.Web.UI.Page
    {
        private static UsersBll bll = new UsersBll();
        //项目信息表
        private static Basic_InfoBll Basicbll = new Basic_InfoBll();
        //部门bll实例化
        private static DepartmentBll depbll = new DepartmentBll();

        protected void Page_Load(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// 绑定部门下拉框
        /// </summary>
        /// <returns></returns>
        public static string departmentBD()
        {
            List<SysDepartment> dept = depbll.DepartmentBD();
            var HtmlStr = "";
            for (var i = 0; i < dept.Count; i++)
            {
                HtmlStr += "<option value=\"" + dept[i].department_Id + "\">" + dept[i].department_Name + "</option>";
            }
            return HtmlStr;
        }

        /// <summary>
        /// 绑定表格
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public static string showKanCha(string DepName)
        {
            var result = Basicbll.DList().Where(m=>m.department_Name.Contains(DepName)).ToList();
            return JsonConvert.SerializeObject(result);
        }
        /// <summary>
        /// 结束勘察
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public static bool updState(string id)
        {
            Model.EABasic_Info b = new Model.EABasic_Info();
            b.basic_State = 3;
            b.projectNumber = id;
            var result = Basicbll.UpdateString(b);
            return result;
        }


    }
}